<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>角色菜单管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/modules/dtree/dtree.css">
    <link rel="stylesheet" href="../../../layuiadmin/modules/dtree/font/dtreefont.css">
</head>

<body>
    <div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
        <fieldset class="layui-elem-field" style="margin-left:25px;min-height:400px">
            <legend>页面权限</legend>
            <div class="layui-field-box">
                <div class="layui-form-item" style="margin-left:20px;">
                    <ul id="menusTree" class="dtree" data-id="0" name = "menuId"></ul>
                </div>
            </div>
        </fieldset>
        <div class="layui-form-item layui-hide">
            <button class="layui-btn" lay-submit lay-filter="user-role-menus-submit" id="user-role-submit">提交</button>
        </div>
    </div>

    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
            , http_proxy: '../myModules/http_proxy'
            , dtree: 'dtree/dtree'
        }).use(['index', 'form', 'dtree', 'http_proxy'], function () {
            var $ = layui.$
                , form = layui.form
                , http_proxy = layui.http_proxy
                , dtree = layui.dtree;

            var params = location.search
                , urid = '';

            if (params && params !== '') {
                urid = params.substring(params.indexOf('=') + 1);
            }

            dtree.render({
                id: 'roleMenusTree'
                , elem: '#menusTree'  //绑定元素
                , url: http_proxy('/menu/getMenuResources')
                , dataStyle: "layuiStyle"  //使用layui风格的数据格式
                , dataFormat: "list"  //配置data的风格为list
                , checkbar: true
                , checkbarType: "all" //复选框的关联关系
                , request: {
                    limit: 1000,
                    urid: urid
                }
                , response: {
                    statusCode: 0, //返回码（必填）
                    rootName: 'rows',
                    treeId: "mpid", //节点ID（必填）
                    parentId: "parentId", //父节点ID（必填）
                    title: "pmName", //节点名称（必填）
                }
            })
        })
    </script>
</body>

</html>